package com.xuecheng.api.config;

import com.xuecheng.api.client.fallback.*;
import feign.Logger;
import feign.codec.Encoder;
import feign.form.spring.SpringFormEncoder;
import org.springframework.context.annotation.Bean;

/**
 * @author 勾新杰
 * @version 1.0
 * @description: 默认feign配置，公有的配置
 * @date 2025/2/16 14:21
 */
public class DefaultFeignConfig {

    /**
     * feign日志级别
     *
     * @return Logger.Level
     */
    @Bean
    public Logger.Level feignLoggerLevel() {
        return Logger.Level.HEADERS;
    }

    /**
     * 媒资管理服务降级
     *
     * @return MediaClientFallBackFactory
     */
    @Bean
    public MediaClientFallBackFactory mediaClientFallBackFactory() {
        return new MediaClientFallBackFactory();
    }

    /**
     * 搜索服务降级
     *
     * @return SearchClientFallBackFactory
     */
    @Bean
    public SearchClientFallBackFactory searchClientFallBackFactory() {
        return new SearchClientFallBackFactory();
    }

    /**
     * 验证码服务降级
     *
     * @return CheckcodeClientFallBackFactory
     */
    @Bean
    public CheckcodeClientFallBackFactory checkcodeClientFallBackFactory(){
        return new CheckcodeClientFallBackFactory();
    }

    /**
     * 内容管理服务降级
     *
     * @return ContentClientFallBackFactory
     */
    @Bean
    public ContentClientFallBackFactory contentClientFallBackFactory(){
        return new ContentClientFallBackFactory();
    }

    /**
     * 学习管理服务降级
     *
     * @return LearningClientFallBackFactory
     */
    @Bean
    public LearningClientFallBackFactory learningClientFallBackFactory(){
        return new LearningClientFallBackFactory();
    }
}
